import request from '@/utils/request'

export function loadDataUrl() {
  return 'v1/userMng/loadData'
}

export function viewMainData(data) {
  return request({
    url: 'v1/userMng/toView',
    method: 'post',
    data
  })
}

export function addOrEdit(data) {
  return request({
    url: 'v1/userMng/doSave',
    method: 'post',
    data
  })
}

export function del(data) {
  return request({
    url: 'v1/userMng/doDelete',
    method: 'post',
    data
  })
}

export function getCpyByUserAccount() {
  return request({
    url: 'v1/userMng/getCpyByUserAccount',
    method: 'get'
  })
}

export function getPrivOrgSetByUserAccount(cpyCode) {
  const data = { 'cpyCode': cpyCode }
  return request({
    url: 'v1/userMng/getPrivOrgSetByUserAccount',
    method: 'post',
    data
  })
}

export function updateCpyOrgSet(data) {
  return request({
    url: 'v1/userMng/updateCpyOrgSet',
    method: 'post',
    data
  })
}

export function updatePassword(data) {
  return request({
    url: 'v1/userMng/updatePassword',
    method: 'post',
    data
  })
}

export function updateEmail(code, data) {
  return request({
    url: 'api/users/updateEmail/' + code,
    method: 'post',
    data
  })
}

